package pers.zb.cloud.service.user.controller;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
public class GoodsController {

    @RequestMapping(value="/good",produces="application/json;charset=UTF-8")
    @ResponseBody
    @PreAuthorize("hasAnyAuthority('BookList')")
    public Map<String,Object> test() {
        //String userName = SecurityContextHolder.getContext().getAuthentication().getName(); //获取当前登录认证的用户名

        Map<String,Object> dataMap = new HashMap<>();
        dataMap.put("goodsName","iphone6 plus");
        dataMap.put("goodsPrice",6480.00);
        return dataMap;
    }
}
